home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / APLocation / Sources / APLocation.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-23  |  4.0 KB  |  177 lines

  1. /*==================================================================
  2.     File:        APLocation.h
  3.     
  4.     Contains:    An AirPort Location Manager module.
  5.  
  6.     Written by:    Ned Holbrook and Eric Gundrum
  7.     
  8.     Copyright:    None
  9. ==================================================================*/
  10.  
  11. /*
  12.      File:        Sample.h
  13.  
  14.      Contains:    Location Manager SDK Sample Module Rez/C includes
  15.  
  16.      Version:    ALM SDK 2.0
  17.                  Package:    Location Manager SDK 2.0
  18.  
  19.      Copyright:    © 1996-1997 by Apple Computer, Inc.
  20.                  All rights reserved.
  21.  
  22.      Bugs?:        Please include the the file and version information (from above) with
  23.                  the problem description.  Developers belonging to one of the Apple
  24.                  developer programs can submit bug reports to:
  25.  
  26.                      devsupport@apple.com
  27.  
  28. */
  29.  
  30. #ifndef        __SAMPLE__
  31. #define        __SAMPLE__
  32.  
  33. // ------------------------------------------------------------------------------------------------- 
  34.  
  35. #ifdef    REZ
  36.  
  37. #include    "Types.r"
  38.  
  39. #else
  40.  
  41. #include    <Types.h>
  42.  
  43. #endif    // REZ
  44.  
  45. // ------------------------------------------------------------------------------------------------- 
  46.  
  47. // Errors...
  48.  
  49. #define        kSampleErrStrRsrcID            10000
  50. #define            kSampleImportPrefDatesIdx    1
  51. #define            kSampleCouldNotQuitIdx        2
  52. #define            kSampleBiggestKnownIdx        kSampleCouldNotQuitIdx
  53.  
  54. // Other text...
  55.  
  56. #define        kSampleMiscStrRsrcID        10001
  57. #define            kSampleDescribeTemplateIdx    1
  58.  
  59. // Constants for common use...
  60.  
  61. #define        kAppListNeverQuit            0x00
  62. #define        kAppListQuitOnSet            0x80
  63. #define        kAppListQuitOnGet            0x40
  64. #define        kAppListQuitOnGetOrSet        0xC0
  65. #define        kAppListLaunchFromEdit        0x20
  66.  
  67. #define        kNoRestart                    0x00
  68. #define        kRestartIfChanged            0x80
  69.  
  70. #define        kExecutableRsrcType            'code'
  71. #define        kExecutableRsrcID            10000
  72.  
  73. #define        kNameRsrcType                'STR '
  74. #define        kNameRsrcID                    10000
  75.  
  76. #define        kDescRsrcType                'STR '
  77. #define        kDescRsrcID                    10001
  78.  
  79. #define        kIconRsrcType                'ICON'
  80. #define        kIconRsrcID                    10000
  81.  
  82. #define        kAppsRsrcType                'apps'
  83. #define        kAppsRsrcTypeString            "apps"
  84. #define        kAppsQuitRsrcID                10000
  85. #define        kAppsEditRsrcID                10001
  86.  
  87. #define        kFilesRsrcType                'fils'
  88. #define        kFilesRsrcTypeString        "fils"
  89. #define        kFilesRsrcStartID            10000
  90.  
  91. #define        kRestartRsrcType            'rstr'
  92. #define        kRestartRsrcTypeString        "rstr"
  93. #define        kRestartRsrcStartID            10000
  94.  
  95. #define        kGetInfoRsrcID                10000
  96.  
  97. #define        kEditMessageRsrcID            10000
  98. #define            kEditOpenButton                1
  99. #define            kEditCancelButton            2
  100. #define            kEditApplyButton            3
  101.  
  102. // ------------------------------------------------------------------------------------------------- 
  103.  
  104. // A bunch of structures we keep in resources; do the rez versions first, then the C versions...
  105.  
  106. #ifdef    REZ
  107.  
  108. // Resource types for this project...
  109.  
  110. type 'TMPL' {
  111.     wide array Fields {
  112.         pstring;        // field name
  113.         string[4];        // field type
  114.     };
  115. };
  116.  
  117. type kAppsRsrcType {
  118.     integer = $$CountOf (AppArray);
  119.     array AppArray {
  120.         string[4];                // Application to quit
  121.         unsigned hex byte
  122.             neverQuit        = kAppListNeverQuit,
  123.             quitOnSet        = kAppListQuitOnSet,
  124.             quitOnGet        = kAppListQuitOnGet,
  125.             quitOnGetOrSet    = kAppListQuitOnGetOrSet,
  126.             launchFromEdit    = kAppListLaunchFromEdit;
  127.         align word;
  128.     };
  129. };
  130.  
  131. type kFilesRsrcType as 'STR ';
  132.  
  133. type kRestartRsrcType {
  134.     unsigned hex byte
  135.         dontRestart            = kNoRestart,
  136.         doRestart            = kRestartIfChanged;
  137.     align word;
  138. };
  139.  
  140. #else
  141.  
  142. #if        PRAGMA_ALIGN_SUPPORTED
  143. #pragma options align=mac68k
  144. #endif    // PRAGMA_ALIGN_SUPPORTED
  145.  
  146. // (Do not require an analog for 'TMPL')
  147.  
  148. typedef struct {
  149.     OSType                applicationCode;
  150.     UInt8                flags;
  151.     UInt8                filler1;
  152. } ApplicationEntry;
  153.  
  154. typedef struct {
  155.     SInt16                applicationCount;
  156.     ApplicationEntry    applications[kVariableLengthArray];
  157. } ApplicationListRec, *ApplicationListPtr, **ApplicationListHandle;
  158.  
  159. typedef struct {
  160.     Str255                fileName;
  161. } FileEntryRec, *FileEntryPtr, **FileEntryHandle;
  162.  
  163. typedef struct {
  164.     UInt8                flags;
  165.     UInt8                filler1;
  166. } FileFlagsRec, *FileFlagsPtr, **FileFlagsHandle;
  167.  
  168. #if        PRAGMA_ALIGN_SUPPORTED
  169. #pragma options align=reset
  170. #endif    // PRAGMA_ALIGN_SUPPORTED
  171.  
  172. #endif    // REZ
  173.  
  174. // ------------------------------------------------------------------------------------------------- 
  175.  
  176. #endif        // __SAMPLE__
  177.